package jaran.poem.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class jdbcpoem

{
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/test?useSSL=False";
        String username="root";
        String password="root";
        Connection connection = DriverManager.getConnection(url, username, password);
        Statement statement = connection.createStatement();
        String sql=" SELECT `id`,`username` from `user` order by `id` desc ";
        ResultSet resultSet = statement.executeQuery(sql);
        while(resultSet.next()) {
            String string = resultSet.getString(1);
            System.out.print(string + "\t");
            string = resultSet.getString(2);
            System.out.print(string + "\n");
        }


    }
}